﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CFSystem.JXC.BLL;
using CFSystem.JXC.Model;
using CFSystem.JXC.IDAL;

namespace CFSystem.JXC.BasisInfo
{
    public partial class FrmStorageTransactionDetailsEdit : Form
    {
        public FrmStorageTransactionDetailsEdit()
        {
            InitializeComponent();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            ITransaction iti = new InvTransInfo();
            InvTransactionData itd = new InvTransactionData();
            itd.ProductID =TxtProductID.Text.Trim();
            itd.ProductName = TxtProductName.Text.Trim();
            itd.ChangeReasonID =Convert.ToInt32(cmbChangeReason.SelectedValue);
            itd.ChangeCount = Convert.ToInt32(TxtChangeCnt.Text.Trim());
            itd.ChangeDate = Convert.ToDateTime(dtpOpsDate.Text.Trim());
            itd.Memo =TxtMemo.Text.Trim();
            iti.InsertInvTransRecord(itd);
        }
        /// <summary>
        /// Load the default setting
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmStorageTransactionDetailsEdit_Load(object sender, EventArgs e)
        {
            LoadcmbChangeReason();
        }
        /// <summary>
        /// Load the selection of cmbChangeReason
        /// </summary>
        private void LoadcmbChangeReason()
        {
            InvChgReasonSetting icrs = new InvChgReasonSetting();
            IList<InvTransReasonSettingInfo> itrsi = icrs.GetInTransReasonSettings();
            cmbChangeReason.DataSource = itrsi;
            cmbChangeReason.DisplayMember = "InvTransReasonName";
            cmbChangeReason.ValueMember = "InvTransReasonID";
        }

        private void cmbChangeReason_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}
